{include file="header.html"}
<style>
.infoTable label {
  display: inline-block;
  height: 25px;
  line-height: 25px;
  margin-left: 5px;
  color: #444;
  float: none !important;
}
.infoTable{width: auto;margin: 0}
</style>
<script type="text/javascript">
$(function(){
    $("[id^='depots']").live('click',function(){
		var id=$(this).attr("item");
		$w=$(window).width();
        $h=$(window).height();
        $w=$w*0.7;
        $("#depotframe").attr("src","index.php?app=wdexuser&act=choosedepot");
    	$("#depotframe").width($w);
        $.colorbox({
            width : $w+20,
            height : "650px",
            inline : true,
            href : "#depotlist"
        });
	});
    checktel();
    $('#user_form').validate({
        errorPlacement: function(error, element){
            $(element).next('.field_notice').hide();
            $(element).after(error);
        },
        success       : function(label){
            label.addClass('right').text('OK!');
        },
        onkeyup    : false,
        rules : {
            user_name : {
                required : true,
                byteRange: [3,15,'{$charset}'],
                remote   : {
                    url :'index.php?app=user&act=check_user',
                    type:'get',
                    data:{
                        user_name : function(){
                            return $('#user_name').val();
                        },
                        id : '{$user.user_id}'
                    }
                }
            },
            password: {
                <!--{if $smarty.get.act eq 'add'}-->
                required : true,
                <!--{/if}-->
                maxlength: 20,
                minlength: 6
            },
            phone_tel : {
                required : true
            }
        },
        messages : {
            user_name : {
                required : '请输入用户名',
                byteRange: '用户名的长度应在3-15个字符之间',
                remote   : '该用户名已经存在了，请您换一个'
            },
            password : {
                <!--{if $smarty.get.act eq 'add'}-->
                required : '密码不能为空',
                <!--{/if}-->
                maxlength: '密码长度应在6-20个字符之间',
                minlength: '密码长度应在6-20个字符之间'
            },
            phone_tel : {
                required : "请输入手机"
            }

        }
    });

});


function changedepot(id,name){
    $('depotframe').colorbox.close();
    $("#depot").val(id);
    $("#depots").val(name);
}

//货主新弹框
function changehz(id,name,hzid,linkman,linktel){
    $('hzframe').colorbox.close();
    $("#unit_ower").val(id);
    $("#unit_ower_name").val(name);
}
function changeop(id,name,tel){
    $('opframe').colorbox.close();
    $("#unit_carrier").val(id);
    $("#unit_carrier_name").val(name);
}
function  checktel(){ 
	 $("#phone_tel").blur(function(){		 
		 var sMobile = document.user_form.phone_tel.value 			 
		 var telReg = !!sMobile.match(/^(0|86|17951)?(13[0-9]|15[012356789]|17[0-9]|18[0-9]|14[57])[0-9]{8}$/);
		 if(telReg == false){
                $(this).addClass("error");
		        document.user_form.phone_tel.focus(); 
		        return false; 
		    }
     });
}
</script>

<div style="display: none"  >
	<div id="depotlist">
	<iframe id="depotframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
	</div>
</div>

<div id="rightTop">
  <p>用户</p>
  <ul class="subnav">
    <li><a class="btn1" href="index.php?app=wdexuser">管理</a></li>
    <li>
      <!-- {if $user.user_id} -->
         <span>编辑</span>
      <!-- {else} -->
        <span>新增</span>
      <!-- {/if} -->
    </li>
  </ul>
</div>
<div class="info">
  <form method="post" enctype="multipart/form-data" id="user_form" name="user_form">
    <table class="infoTable">
      <tr>
          <input class="infoTableInput2" name="type" type="hidden" value="{$user.type}" />
        <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b> 用户名：</th>
        <td class="paddingT15 wordSpacing5">
            <!-- {if $user.user_id} -->
            {$user.user_name|escape}
            <!-- {else} -->
            <input class="infoTableInput2" id="user_name" placeholder="3-25位,必填" type="text" name="user_name" value="{$user.user_name|escape}" />
            <!-- {/if} -->
        </td>
      </tr>
      <tr>
        <th class="paddingT15"> 姓名：</th>
        <td class="paddingT15 wordSpacing5"><input class="infoTableInput2" name="real_name" type="text" id="real_name" value="{$user.real_name|escape}" />        </td>
      </tr>
      <tr>
        <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>密码：</th>
        <td class="paddingT15 wordSpacing5">
            <input class="infoTableInput2" name="password" type="text" id="password" value=""/>
            <!-- {if $user.user_id} -->
            <span class="grey"> 留空表示不修改密码</span>
            <!-- {/if} -->
        </td>
      </tr>
       <tr>
            <th class="paddingT15"><b style="color: #ff0000">*&nbsp;</b>手机：</th>
            <td class="paddingT15 wordSpacing5">
                <input class="infoTableInput2" name="phone_tel" type="text" id="phone_tel" value="{$user.phone_tel|escape}" />
            </td>
      </tr>
       <tr>
        <th class="paddingT15"> 绑定仓库：</th>
        <td class="paddingT15 wordSpacing5">
        
        <input id="depot" name="depot" type="hidden" value="{$user.depot}"/>
        <input class="infoTableInput2" placeholder="请选择仓库" name="depots" type="text" id="depots" readonly="readonly" value="{$sname|escape}" />
        
        </td>
      </tr>
      <tr>
        <th class="paddingT15">放箱客户：</th>
        <td class="paddingT15 wordSpacing5"><p style="float: left">
            
            
            <label style="margin-right: 0">
            <input name="fx" type="radio" value="1" {if $user.fx == 1}checked="checked"{/if} />
            是</label><label style="margin-right: 0">
            <input type="radio" name="fx" value="0" {if $user.fx == 0}checked="checked"{/if} />
           否</label>
          </p>
        </td>
      </tr>
      <tr style="display: none">
        <th class="paddingT15">性别:</th>
        <td class="paddingT15 wordSpacing5"><p>
            <label>
            <input name="gender" type="radio" value="0" {if $user.gender == 0}checked="checked"{/if} />
            保密</label>
            <label>
            <input type="radio" name="gender" value="1" {if $user.gender == 1}checked="checked"{/if} />
            男</label>
            <label>
            <input type="radio" name="gender" value="2" {if $user.gender == 2}checked="checked"{/if} />
            女</label>
          </p>
        </td>
      </tr>
      <!--<tr>
        <th class="paddingT15"> <label for="phone_tel">{$lang.phone_tel}:</label></th>
        <td class="paddingT15 wordSpacing5"><input name="phone_tel[]" id="phone_tel" type="text" size="4" value="{$phone_tel.0}" />
          -
          <input class="infoTableInput2" name="phone_tel[]" type="text" value="{$phone_tel.1}" />
          -
          <input name="phone_tel[]" type="text" size="4" value="{$phone_tel.2}" />
        </td>
      </tr>
      <tr>
        <th class="paddingT15"> {$lang.phone_mob}:</th>
        <td class="paddingT15 wordSpacing5"><input class="infoTableInput2" name="phone_mob" type="text" id="phone_mob" value="{$user.phone_mob|escape}" />
        </td>
      </tr>
      <tr>
        <th class="paddingT15"> {$lang.im_qq}:</th>
        <td class="paddingT15 wordSpacing5"><input class="infoTableInput2" name="im_qq" type="text" id="im_qq" value="{$user.im_qq|escape}" />        </td>
      </tr>
      <tr>
        <th class="paddingT15"> {$lang.im_msn}:</th>
        <td class="paddingT15 wordSpacing5"><input class="infoTableInput2" name="im_msn" type="text" id="im_msn" value="{$user.im_msn|escape}" />        </td>
      </tr>

     {if !$set_avatar}
      <tr>
        <th class="paddingT15">{$lang.portrait}:</th>
        <td class="paddingT15 wordSpacing5"><input class="infoTableFile2" type="file" name="portrait" id="portrait" />
          
          {if $user.portrait}<br /><img src="../{$user.portrait}" alt="" width="100" height="100" />{/if}           </td>
      </tr>
     {else}
        {if $smarty.get.act eq 'edit'}
      <tr>
        <th class="paddingT15">{$lang.portrait}:</th>
        <td class="paddingT15 wordSpacing5">{$set_avatar}</td>
      </tr>
        {/if}
     {/if}-->
      <tr>
        <th></th>
        <td class="ptb20"><input class="formbtn" type="submit" name="Submit" value="{$lang.submit}" /> </td>
      </tr>
    </table>
  </form>
</div>
<div style="display: none"  >
    <div id="hzlist">
        <iframe id="hzframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
    </div>
</div>
<div style="display: none"  >
    <div id="oplist">
        <iframe id="opframe" width="" height="600px" frameborder="0" scrolling="no"></iframe>
    </div>
</div>
{include file="footer.html"}